package socketTest;

public class ReadSocketStrTest {

  public static void main(String[] args) throws Exception {
    /****
     *       a5 01 00 00 00 00   00 00 2c 00 00 00 00 00
     * 00 00 00 00 00 00 00 00   00 00 01 00 00 00 18 00
     * 00 00 ab 04 00 00 00 00   00 00 18 00 00 00 53 72
     * ba c0 dc ef 75 20 b7 12   92 f7 46 3f 4c 43 ab 04
     * 00 00 00 00 00 00
     */
    /***
     * 请求解密的报文头(1+1+2+4+4+8+4)共计24字节
     * uint8_t cmd; //命令字--->a5
     * uint8_t version; //协议版本号-->01
     * uint8_t padding[2]; //填充--->00 00
     * uint32_t colID; // 列ID-->00 00 00 00
     * uint32_t extLen; //扩展内容的长度--> 2c 00 00 00
     * uint32_t reserved[2]; //保留位--> 00 00 00 00 00 00 00 00
     * uint32_t checkSum; //头部校验和,采用crc32算法.-->00 00 00 00
     *
     * 请求解密的报文包体
     * uint32_t group_count; //组个数--->01 00 00 00
     * uint32_t group1_len; //组1长度--->18 00 00 00
     * uint32_t group1_len; //组2，组3，组n长度--->目前只有1组，因此没有
     * uint64_t group1_keyID; //组1的密钥ID-->53 72 ba c0 dc ef 75 20
     * uint32_t group_len; //数据总长度-->b7 12 92 f7
     * uint32_t a_group1_data; //组1的数据.-->
     */
/****
 * 01 00 00 00
 * 18 00 00 00
 * ab 04 00 00 00 00   00 00
 * 18 00 00 00
 * 53 72 ba c0 dc ef 75 20 b7 12   92 f7 46 3f 4c 43 ab 04
 * 00 00 00 00 00 00
 */

    byte[] contents = new byte[256];
    contents[0] = (byte) 0xa5;

    System.out.println(hex2decimal("a5"));
  }

  /****
   * 请求解密:
   a4 10 00 00 00 00 00 00 18 00
   00 00 00 00 00 00 00 00 00 00 fb c0 63 29 01 00
   00 00 04 00 00 00 ad 04 00 00 00 00 00 00 04 00
   00 00 54 45 53 54
   */

  /**
   * 16进制转10进制
   */
  public static int hex2decimal(String hex) {
    return Integer.parseInt(hex, 16);
  }
}
